#pragma once
#include <iostream>
#include <string>
#include "InetAddr.hpp"

class TcpServer;


//基类 //相当于红黑树内的节点？用于回调？ 监听套接字的回调就是accpet新的连接？
class Connection
{
public:
    Connection()
    {

    }
    virtual void Recev() = 0;
    virtual void Sender() = 0;
    virtual void Excepter() = 0;

    void SetEvent(const uint32_t &events)
    {
        _event = events;
    }

    uint32_t GetEvent()
    {
        return _event;
    } 

    void SetFd(int sockfd)
    {
        _sockfd = sockfd;
    }

    int GetFd()
    {
        return _sockfd;
    }
    
    ~Connection()
    {

    }

private:
    int _sockfd;
    std::string _inbuffer;
    std::string _outbuffer;

    TcpServer *_owner;

    InetAddr _client_addr;

    uint32_t _event;
};

